class SongCredit < ActiveRecord::Base
  #Relations
  belongs_to :artist
  belongs_to :song

  #Constants
  ROLES = %w(Performance Composed)
  
  #Callbacks
  after_create :new_entry_edit
  after_update :create_edit

  #Validations
  #validates_associated :artist
  validates_associated :song
  
  private

  #
  #
  def new_entry_edit
      entry = Hash.new
      entry.store("created credit", [artist.to_s, song.to_s])
      Edit.create_edit(entry, artist)
  end

  #
  #
  def create_edit
    if self.changed?
      puts changes
      Edit.create_edit(self.changes, artist)
    end
  end

end
